cmake_minimum_required(VERSION 3.10)
project(GRPCCalculatorDemo)

# C++17标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 查找gRPC和Protobuf包
find_package(Protobuf CONFIG REQUIRED)
find_package(gRPC CONFIG REQUIRED)

# 服务端可执行文件
add_executable(calculator_server 
    server.cpp calculator.grpc.pb.cc calculator.pb.cc
)

# 客户端可执行文件
add_executable(calculator_client 
    client.cpp calculator.grpc.pb.cc calculator.pb.cc
)

# 链接库
target_link_libraries(calculator_server 
    protobuf::libprotobuf
    gRPC::grpc++ 
    gRPC::grpc++_reflection
)

target_link_libraries(calculator_client 
    protobuf::libprotobuf
    gRPC::grpc++ 
    gRPC::grpc++_reflection
)